﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI.WebControls;
using KPIS.GERP.Models;
using WebMatrix.WebData;

namespace KPIS.GERP.WEB.GFMS.Class
{
    public static class GimsUtilities
    {
        public static string ControllerName(HtmlHelper helper)
        {
            return (string) helper.ViewContext.RouteData.GetRequiredString("controller");
        }

        public static string ActionName(HtmlHelper helper)
        {
            return (string) helper.ViewContext.RouteData.GetRequiredString("action");
        }

        public static string ClientIp
        {
            get { return HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; }
        }

        public static string ThisSystemId
        {
            get { return "WEBGIMS"; }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="strLayoutName">"Site", "Empty"</param>
        /// <returns></returns>
        public static string GetLayout(string strLayoutName)
        {
            string strResult = "";
            switch (strLayoutName.ToLower().Trim())
            {
                case "site":
                    strResult = "~/Views/Shared/_SiteLayout.cshtml";
                    break;
                case "empty":
                    strResult = "~/Views/Shared/_EmptyLayout.cshtml";
                    break;
                default:
                    break;
            }
            return strResult;
        }
    }
}